#!/bin/bash

#eval $(xdotool getdisplaygeometry --shell)

ses="work"
session=$(screen -ls | grep $ses)
if [ -z "$session" ]; then
    cd $HOME/src/pop-research/
    screen -dmS $ses
    cd $HOME
    olv init $ses
    exit
fi

case "$session" in
    *Detached*)
	sleep 2 && olv init $ses &
	screen -ddr $ses
	exit
    ;;
esac

#set first frame
screen -S $ses -X screen
screen -S $ses -X split -v
screen -S $ses -X resize 70%
screen -S $ses -X focus right
#set second frame
screen -S $ses -X screen 10
screen -S $ses -X split
screen -S $ses -X resize -v 70%
screen -S $ses -X focus down
#setup 3rd frame
screen -S $ses -X select 0
screen -S $ses -X focus left

#set irssi frame
screen -S $ses -p 10 -X stuff "olv init irssi^M"
